/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.amse.grigory.dchess.kernel;

import java.util.ArrayList;

/**
 *
 * @author grigory
 */
public class PreviousMove {

    private Square[] myChange;
    private int[] myX,  myY;
    private PreviousMove(){
        
    }

    public PreviousMove(ArrayList<Square> squares, ArrayList<Integer> x, ArrayList<Integer> y) {
        int n = x.size();
        myChange = new Square[n];
        myX = new int[n];
        myY = new int[n];
        for (int i = 0; i < n; ++i) {
            myChange[i]=squares.get(i).clone();
            myX[i]=x.get(i);
            myY[i]=y.get(i);
        }
    }


    @Override
    public PreviousMove clone(){
        PreviousMove pmove=new PreviousMove();
        int n = myX.length;
        pmove.myChange = new Square[n];
        pmove.myX = new int[n];
        pmove.myY = new int[n];
        for (int i = 0; i < n; ++i) {
            pmove.myChange[i]=myChange[i].clone();
            pmove.myX[i]=myX[i];
            pmove.myY[i]=myY[i];
        }
        return pmove;
    }

    public int getX(int index) {
        return myX[index];
    }

    public void setX(int index, int x) {
        myX[index] = x;
    }

    public int getY(int index) {
        return myY[index];
    }

    public void setY(int index, int y) {
        myY[index] = y;
    }

    public Square getSquare(int index) {
        return myChange[index];
    }

    public int getCount() {
        return myX.length;
    }
}
